package daobeauty.interceptor.invoke.fill;

import org.hibernate.Query;

/**
 * Fills the parameters of a query from an array of Objects, which is the first parameter.
 * 
 * @author M.Serhat Cinar
 *
 */
public class ArrayQueryFill implements ParameterFillStrategy {

	public void fillParameters(Object q, Object[] parameters) {
		final Query query = (Query) q;
		final Object [] array = (Object[]) parameters[0];
		for (int i=0; i<array.length; i++){
			query.setParameter(i, array[i]);
		}
	}

	public String toString(){
		return "array";
	}

}
